

<template>
  <!-- <img alt="Vue logo" src="./assets/logo.png" /> -->
  <el-button type="primary">{{str}}</el-button>
</template>


<script setup>
// This starter template is using Vue 3 <script setup> SFCs
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
import HelloWorld from "./components/HelloWorld.vue";
import { getCurrentInstance, onMounted,ref } from "vue";
let str = ref(0)
const demo = async () => {
  const { proxy } = getCurrentInstance();
  // const loginState = proxy.$weApp.auth({
  //   persistence: "session"
  // })
  // .anonymousAuthProvider()
  // .signIn()
  // .then(() => {
  //   // 登录成功
  //   console.log(123)

  // })
  // .catch((err) => {
  //   // 登录失败
  //   console.log(456)
  // })
  // await proxy.$weApp.auth({
  //   persistence: "local" //用户显式退出或更改密码之前的30天一直有效
  // })
  let a = await proxy.$weApp.auth({
    // persistence: "local" //用户显式退出或更改密码之前的30天一直有效
  });
};
onMounted(() => {
  demo();
  const { proxy } = getCurrentInstance();
  proxy.$weApp
    .callFunction({
      name: "user",
      data: { type: "myInvite" },
    })
    .then((res) => {
      console.log("res");
      console.log(res);
      str.value = res.result
      const result = res.result; //云函数执行结果
    });
});
</script>
<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>